package min.chapter.four.entrance;

import min.chapter.four.entrance.HomeController;
import min.chapter.four.entrance.InfraredRaySensor;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class EntranceAcquisition {
	public static void main(String[] args) {
		String[] configLocations = new String[] { "min/chapter/four/Door.xml" };
		AbstractApplicationContext context = new ClassPathXmlApplicationContext(configLocations);
		
		context.registerShutdownHook();
		
		HomeController homeControl = context.getBean("homeController", HomeController.class);
		homeControl.checkSensorAndAlarm();
		
		InfraredRaySensor doorSensor = context.getBean("doorSensor", InfraredRaySensor.class);
		doorSensor.foundObject();
		
		homeControl.showCameraImage();
		homeControl.checkSensorAndAlarm();
	}
}